{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia djangollery_admin %}
{% block content %}

    <div id="content-main">
        {% block object-tools %}
        {% if not is_popup %}
          <ul class="object-tools">
                <li>
                <a href="/admin/djangollery/flickrphoto/flickr/?height=600&width=400" class="thickbox" title="Search in Flickr">Search in Flickr</a>  
                </li>
          </ul>
        {% endif %}
        {% if change %}
            {% if not is_popup %}
              <ul class="object-tools">
              <li><a href="history/" class="historylink">{% trans "History" %}</a></li>
              {% if has_absolute_url %}
                <li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>
              {% endif%}
              </ul>
            {% endif %}
        {% endif %}
        <div id="searchFlickr"></div>
        {% endblock %}
        <form {% if has_file_field %}enctype="multipart/form-data" {% endif %} action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}
            <div>
            {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
            {% if save_on_top %}{% submit_row %}{% endif %}
            {% if errors %}
                <p class="errornote">
                {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
                </p>
                <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
            {% endif %}
            <fieldset class="module aligned">
                {% render_field adminform.form.title %}
                {% render_field adminform.form.title_slug %}
                {% render_field adminform.form.caption %}
				{% render_field adminform.form.is_public %}
				{% render_field adminform.form.tags %}
                <div class="form-row">
					{{adminform.form.thumbnail.label_tag }}
					<fieldset class="aligned" style="border: medium none ;">
                    	<a href="/admin/djangollery/flickrphoto/flickr/?height=600&width=400" class="thickbox" title="Select from Flickr">
	                    Select from Flickr
	                    </a><br/>
	                    {{adminform.form.thumbnail }}
					</fieldset>
                </diV>
				{% render_field adminform.form.display %}
                {% render_field adminform.form.original %}
            </fieldset>

            {% submit_row %}

            {% if add %}
               <script type="text/javascript">document.getElementById("{{ adminform.first_field.auto_id }}").focus();</script>
            {% endif %}

            {# JavaScript for prepopulated fields #}
            {% prepopulated_fields_js %}

            </div>
        </form>
    
    </div>
{% endblock %}
